package com.cgtong.android.mvp.model;

import com.cgtong.android.bean.ActivityDetailBean;
import com.cgtong.android.http.ApiManager;
import com.cgtong.android.mvp.contract.ActivityDetailContract;
import com.zhouyou.http.EasyHttp;
import com.zhouyou.http.callback.CallBackProxy;
import com.zhouyou.http.callback.SimpleCallBack;
import com.zhouyou.http.model.ApiResult;

/**
 * Created by Sky.Bing on 2017/10/25.
 */

public class ActivityDetailModel implements ActivityDetailContract.Model {
    @Override
    public void getActivityDetail(int activityId, SimpleCallBack callBack) {
        EasyHttp.post(ApiManager.URL_ACTIVITY_DETAIL)
                .params("id", String.valueOf(activityId))
                .accessToken(true)
                .execute(new CallBackProxy<ApiResult<ActivityDetailBean>, ActivityDetailBean>(callBack) {
                });
    }

    @Override
    public void postActivityVote(int activityId, String voteItems, SimpleCallBack callBack) {
        EasyHttp.post(ApiManager.URL_ACTIVITY_VOTE)
                .params("id", String.valueOf(activityId))
                .params("voteItems", "["+voteItems+"]")
                .accessToken(true)
                .execute(new CallBackProxy<ApiResult<Object>, Object>(callBack) {
                });
    }
}